{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([    0,     1,     2, ..., 99997, 99998, 99999])"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import numpy as np\n",
    "x=np.arange(100000)\n",
    "np.mean(x) # 计算矩阵x的均值\n",
    "np.median(x) # 计算矩阵x的中位数\n",
    "np.std(x) # 计算矩阵x的标准差\n",
    "np.var(x) # 计算矩阵x的方差\n",
    "np.max(x) # 计算矩阵x的最大值\n",
    "np.min(x) # 计算矩阵x的最小值\n",
    "np.argmax(x) # 计算矩阵x的最大值的索引\n",
    "np.argmin(x) # 计算矩阵x的最小值的索引\n",
    "np.cumsum(x) # 计算矩阵x的累加和\n",
    "np.cumprod(x) # 计算矩阵x的累乘积\n",
    "x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([5.59016994, 5.59016994, 5.59016994, 5.59016994, 5.59016994])"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y=np.linspace(1,20,20,dtype=np.int32).reshape(4,5)\n",
    "np.mean(y,axis=0) #求每一列的平均值\n",
    "np.mean(y,axis=1) #求每一行的平均值\n",
    "np.sum(y,axis=0) #求每一列的和\n",
    "np.sum(y,axis=1) #求每一行的和\n",
    "np.std(y,axis=0) #求每一列的标准差\n",
    "np.ptp(y) #求最大值与最小值的差值\n",
    "np.ptp(y,axis=0) #求每一列的最大值与最小值的差值"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "machineLearn",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
